<?php
namespace App\Models\Requests;

class SurveyRequest extends BaseRequest
{
    public function rules()
    {
        switch ($this->method()) {
            case 'GET':
                {
                    return [
                        'id' => ['required']
                    ];
                }
            case 'POST':
                {
                    return [
                        'name' => ['required', 'string', 'max:60','min:4','unique:survey,name'],
                    ];
                }
            case 'PUT':
            case 'PATCH':
            case 'DELETE':
            default:
                {
                    return [

                    ];
                }
        }
    }

    public function messages()
    {
        return [
            'id.required' => '问卷调查ID必须填写',
            'id.exists' => '问卷调查不存在',
            'name.unique' => '问卷调查已经存在',
            'name.required' => '问卷调查不能为空',
            'name.max' => '问卷调查最大长度为60个字符',
            'name.min' => '问卷调查最小长度为4个字符',
        ];
    }
}
